using System;
using System.Text;
using System.Data;
using System.Xml;
using System.Xml.Linq;
using System.Threading;
using System.Runtime.InteropServices;
using System.Reflection;

namespace CEDebugCF
{
    public static class CEDebugCF_DebugMacros
    {
        /*
CEDebugCF_API void  RetailMsg( BOOL expression, LPWSTR message);

CEDebugCF_API void  DebugMsg( BOOL expression, LPWSTR message);

CEDebugCF_API void  ErrorMsg( BOOL expression, LPWSTR message);

CEDebugCF_API void  Assert( BOOL expression);

CEDebugCF_API void  AssertMsg( BOOL expression,LPWSTR message);

CEDebugCF_API void  RetailLED( BOOL expression, WORD Index, DWORD dwPattern);

CEDebugCF_API void  DebugLED( BOOL expression, WORD Index, DWORD dwPattern);

CEDebugCF_API void  Trace( BOOL expression, LPWSTR message, int LineNo);

         * */



        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#1")]
        public static extern void Assert([MarshalAs(UnmanagedType.Bool)] bool expression);

        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#2")]
        public static extern void AssertMsg([MarshalAs(UnmanagedType.Bool)] bool expression, string message);

        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#3")]
        public static extern void DebugLED([MarshalAs(UnmanagedType.Bool)] bool expression, uint Index, uint dwPattern);

        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#4")]
        public static extern void DebugMsg([MarshalAs(UnmanagedType.Bool)] bool expression, string message);

        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#5")]
        public static extern void ErrorMsg([MarshalAs(UnmanagedType.Bool)] bool expression, string message);

        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#6")]
        public static extern void RetailLED([MarshalAs(UnmanagedType.Bool)] bool expression,uint Index, uint dwPattern);

        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#7")]
        public static extern void RetailMsg([MarshalAs(UnmanagedType.Bool)] bool expression, string message);


        [DllImport("\\Windows\\CEDebugCFNative.dll", EntryPoint = "#8")]
        public static extern void Trace([MarshalAs(UnmanagedType.Bool)] bool expression, string message, int LineNo);

        public static void AssertMsgCS(bool expression , string message)
        {
            if (!expression)
            {
                RetailMsg(expression, message);
                System.Windows.Forms.Application.Exit();
            }
        }

        //http://msdn.microsoft.com/query/dev11.query?appId=Dev11IDEF1&l=EN-US&k=k(System.Diagnostics.StackFrame);k(StackFrame);k(DevLang-csharp)&rd=true

    }
}
